package com.wh.hotel.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author luweije
 */

@Getter
@AllArgsConstructor
public enum CancelTypeEnum {

    CANNOT(0, "不可取消"),
    ANY_FREE(1, "任意免费取消"),
    LIMIT_TIME(2, "限时取消"),
    ;

    private final int code;
    private final String desc;

    public static CancelTypeEnum parse(Integer code) {
        if (code == null) {
            return null;
        }
        for (CancelTypeEnum cancelTypeEnum : CancelTypeEnum.values()) {
            if (cancelTypeEnum.getCode() == code) {
                return cancelTypeEnum;
            }
        }
        return null;
    }
}
